Skip to content

Friendlier handling of default webhook values on bot launch #1263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2025

Conversation

christolis
Copy link
Member

Description

I have noticed that when inexperienced people just getting started on the project go through all the hoops of cloning the repository, setting up their Discord bots, creating their test server, they end up compiling the code in IDEs like IntelliJ IDEA and assuming they just change the token on their config.json, there are stacktraces and errors thrown once they attempt to run the bot. Specifically:

    Caused by: java.net.URISyntaxException: Illegal character in path at index 0: <put_your_webhook_here>
            at java.base/java.net.URI$Parser.fail(URI.java:2995)
            at java.base/java.net.URI$Parser.checkChars(URI.java:3166)
            at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3248)
            at java.base/java.net.URI$Parser.parse(URI.java:3207)
            at java.base/java.net.URI.<init>(URI.java:645)
            at java.base/java.net.URI.create(URI.java:930)

image
For the average software engineer, they would be aware that the program is still running and that the bot is ready, but two things:

  • Someone who is not trained enough and is just starting to contribute will get thrown off by the error and potentially give up (I have experienced it happening)
  • It's a generally better experience for knowledgable new contributors to set up the project effortlessly so that they can get started with contributing straight away without any stacktraces.

What I've done

This commit prints a friendly warning in the logger and no stacktrace in case the user has not updated the webhooks (which most of them will not have to, as they are primarily concerned with the Discord bot's token).

We hide the stacktrace in case there is a <put_your_webhook_here> value in the logInfoChannelWebhook and logErrorChannelWebhook configuration keys so that IntelliJ IDEA does not put the stacktrace in the spotlight and potentially scare new contributors.

I have noticed that when inexperienced people just getting started on
the project go through all the hoops of cloning the repository, setting
up their Discord bots, creating their test server, they end up compiling
the code in IDEs like IntelliJ IDEA and assuming they just change the
token on their `config.json`, there are stacktraces and errors thrown
once they attempt to run the bot. Specifically:

    Caused by: java.net.URISyntaxException: Illegal character in path at index 0: <put_your_webhook_here>
            at java.base/java.net.URI$Parser.fail(URI.java:2995)
            at java.base/java.net.URI$Parser.checkChars(URI.java:3166)
            at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3248)
            at java.base/java.net.URI$Parser.parse(URI.java:3207)
            at java.base/java.net.URI.<init>(URI.java:645)
            at java.base/java.net.URI.create(URI.java:930)

For the average software engineer, they would be aware that the program
is still running and that the bot is ready, but two things:

    - Someone who is not trained enough and is just starting to contribute
      will get thrown off by the error and potentially give up (I have
      experienced it happening)

    - It's a generally better experience for knowledgable new contributors
      to set up the project effortlessly so that they can get started with
      contributing straight away without any stacktraces.

This commit prints a friendly warning in the logger and no stacktrace in
case the user has not updated the webhooks (which most of them will not
have to, as they are primarily concerned with the Discord bot's token).

We hide the stacktrace in case there is a "<put_your_webhook_here>"
value in the "logInfoChannelWebhook" and "logErrorChannelWebhook"
configuration keys so that IntelliJ IDEA does not put the stacktrace in
the spotlight and potentially scare new contributors.

Signed-off-by: christolis <work@chris-sdogkos.com>
@christolis christolis requested a review from a team as a code owner June 27, 2025 10:47
@christolis christolis self-assigned this Jun 27, 2025
@christolis christolis added the enhancement New feature or request label Jun 27, 2025
@Zabuzard Zabuzard merged commit 8b2d3c5 into Together-Java:develop Jun 27, 2025
9 checks passed
christolis added a commit to christolis/TJ-Bot that referenced this pull request Jun 28, 2025
I have noticed that when inexperienced people just getting started on
the project go through all the hoops of cloning the repository, setting
up their Discord bots, creating their test server, they end up compiling
the code in IDEs like IntelliJ IDEA and assuming they just change the
token on their `config.json`, there are stacktraces and errors thrown
once they attempt to run the bot. Specifically:

    Caused by: java.net.URISyntaxException: Illegal character in path at index 0: <put_your_webhook_here>
            at java.base/java.net.URI$Parser.fail(URI.java:2995)
            at java.base/java.net.URI$Parser.checkChars(URI.java:3166)
            at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3248)
            at java.base/java.net.URI$Parser.parse(URI.java:3207)
            at java.base/java.net.URI.<init>(URI.java:645)
            at java.base/java.net.URI.create(URI.java:930)

For the average software engineer, they would be aware that the program
is still running and that the bot is ready, but two things:

    - Someone who is not trained enough and is just starting to contribute
      will get thrown off by the error and potentially give up (I have
      experienced it happening)

    - It's a generally better experience for knowledgable new contributors
      to set up the project effortlessly so that they can get started with
      contributing straight away without any stacktraces.

This commit prints a friendly warning in the logger and no stacktrace in
case the user has not updated the webhooks (which most of them will not
have to, as they are primarily concerned with the Discord bot's token).

We hide the stacktrace in case there is a "<put_your_webhook_here>"
value in the "logInfoChannelWebhook" and "logErrorChannelWebhook"
configuration keys so that IntelliJ IDEA does not put the stacktrace in
the spotlight and potentially scare new contributors.

Signed-off-by: christolis <work@chris-sdogkos.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants